// part1:C06:ex6.23.cpp
// three print methods.
#include <iostream>
using namespace std;

void print1(const int *p) {
  cout << *p << endl;
}

void print2(const int *p, const int sz) {
  int i = 0;
  while (i != sz) {
    cout << *p++ << endl; 
    ++i;
  }
}

void print3(const int *begin, const int *end) {
  for (auto ptr = begin; ptr != end; ++ptr) {
    cout << *ptr << endl; 
  }
}

int main(void) {
  int i = 0, arr[2] = {0, 1};
  print1(&i);
  print1(arr);
  print2(&i, 1);

  print2(arr, sizeof(arr) / sizeof(*arr));
  
  auto b = begin(arr);
  auto e = end(arr);
  print3(b, e);

  return 0;
}
